import { strokeRect } from "@/utils/common"
export default class Box {
  constructor(key, x, y, width, height, color = 'green', lineWidth = 3) {
    this.key = key
    this.x = x
    this.y = y
    this.width = width
    this.height = height
    this.color = color
    this.lineWidth = lineWidth
  }

  draw(ctx) {
    ctx.beginPath()
    ctx.lineWidth = this.lineWidth * window.devicePixelRatio
    ctx.strokeStyle = this.color
    strokeRect(ctx, this.x, this.y, this.width, this.height)
  }

  deepCopy() {
    return new Box(this.key, this.x, this.y, this.width, this.height, this.color, this.lineWidth)
  }
}